/*
    Copyright (c) 2012-2013 The Ohio State University.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

#ifndef __SSB_HASHJOIN__
#define __SSB_HASHJOIN__

#include "common.h"

struct joinNode{
    int totalAttr;                  /* the toal number of attributes generated by the join */
    int tupleSize;                  /* the size of the tuple in the join result */
    struct tableNode *leftTable;    /* the fact table */
    struct tableNode *rightTable;   /* the dimension table */
    
    int leftKeyIndex;               /* the index of factable's join key */
    int rightKeyIndex;              /* the index of dimension table's join key */

    int leftOutputAttrNum;          /* the number of output attributes from the fact table */
    int * leftOutputIndex;          /* the index of the output attributes from the fact table */
    int * leftOutputAttrType;       /* the type of the output attributes from the fact table */
    int * leftPos;                  /* the final position of the output attributes from the fact table */

    int rightOutputAttrNum;         /* the number of output attributes from the dimension table */
    int * rightOutputIndex;         /* the index of the output attributes from the dimension table */
    int * rightOutputAttrType;      /* the type of the output attributes from the dimension table */
    int * rightPos;                 /* the final position of the output attributes from the dimenstion table */

    int * keepInGpu;                /* whether the result should be kept in GPU global memory or not.
                                        1 doesn't imply that the data will be 100% in the GPU. 
                                        It may still be in CPU memory if the original data is not loaded into GPU
                                     */
};


#endif
